package com.rc.web.controller;

import com.rc.pojo.vo.IntegralDetailListVO;
import com.rc.web.service.IntegralDetailService;
import io.swagger.annotations.Api;
import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

/**
 * 活动表 控制层。
 *
 * @author sym
 * @since 2024-05-26
 */
@RestController
@RequestMapping("/integralDetail")
@Api(tags = "积分详情")
@RequiredArgsConstructor
@Validated
public class IntegralDetailController {
    private final IntegralDetailService integralDetailService;


    @GetMapping("/list")
    public IntegralDetailListVO list() {
        return integralDetailService.getList();
    }


    @PostMapping("/add")
    public String addIntegral(@RequestParam Integer integral,
                              @RequestParam String title) {
        boolean result = integralDetailService.addIntegral(integral, title);
        return result ? "保存成功" : "保存失败";
    }

}
